import * as React from 'react'
import { Route, HashRouter as Router, Switch } from 'react-router-dom'
import {
  Login,
  Index,
  Thdemand,
  ThdemandInfo,
  ThdemandUpload,
  SupplierInfo,
  Band,
  BandForm,
  Parameter,
  TypeParam,
  ColorParam,
  SeasonParam,
  SizeParam,
  ShopgradeParam,
  SupplierStyle,
  Fabric,
  DataPermission,
  TypeParamForm,
  ColorParamForm,
  SeasonParamForm,
  SizeParamForm,
  ShopgradeParamForm,
  SupplierStyleForm,
  FabricForm,
  DataPermissionForm,
  NewInfo,
  Apply,
  ApplyDetail,
  ApplyUpload,
  Primary,
  PrimaryForm,
  Eliminate,
  SecondInstance,
  SecondInstanceDetail,
  Order,
  OrderDetail,
  TakeOrder,
  TakeOrderDetail,
  ReturnOrder,
  ReturnOrderDetail,
  DebitOrder,
  DebitOrderDetail,
  Ckphoto,
  CkphotoDetail,
  Push,
  Audition,
  Resolve,
  ResolveDetail,
  BuyerConfrim,
  BuyerConfrimList,
  TakeGoods,
  OneCheckDetail,
  TakeGoodsDetail,
  OneCheck,
  OneResolve,
  OneResolveDetail,
  Out,
  OutDetail,
  CheckStyle,
  DataCheck,
  DataCheckdETAIL,
  SecordSubmit,
  SecordSubmitDetail,
  StatementOrder,
  StatementOrderDetail,
  InvoiceOrder,
  InvoiceOrderDetail,
  PaymentOrder,
  PaymentOrderDetail,
  ManagerApproval,
  ManagerApprovalDetail,
  SecordApproval,
  SecordApprovalDetail,
  CateImg
} from './View'

export const indexRouter: any [] = [
  { path: '/thdemand', exact: true, name: '波段需求', component: Thdemand},
  { path: '/thdemand/info', exact: true, name: '波段规划详情', component: ThdemandInfo},
  { path: '/thdemand/upload', exact: true, name: '样衣上传', component: ThdemandUpload},
  { path: '/supbase', exact: true, name: '供应商资料', component: SupplierInfo},
  { path: '/band', exact: true, name: '波段计划管理', component: Band},
  { path: '/band/edit', exact: true, name: '波段规划维护', component: BandForm},
  { path: '/ssffaawer', exact: false, name: '补货参数维护', component: Parameter},
  { path: '/goodsinfo', exact: true, name: '新品资料', component: NewInfo},
  { path: '/apply', exact: true, name: '样衣申请列表', component: Apply},
  { path: '/apply/detail', exact: true, name: '样衣详情', component: ApplyDetail},
  { path: '/apply/upload', exact: true, name: '样衣上传', component: ApplyUpload},
  { path: '/first', exact: true, name: '样衣初选单', component: Primary},
  { path: '/first/edit', exact: true, name: '样衣邮寄', component: PrimaryForm},
  { path: '/eliminate', exact: true, name: '淘汰样衣', component: Eliminate},
  { path: '/spend-analysis', exact: true, name: '二审资料补充', component: SecondInstance},
  { path: '/spend-analysis/detail', exact: true, name: '二审资料详情', component: SecondInstanceDetail},
  { path: '/orderlist', exact: true, name: '采购订单', component: Order},
  { path: '/orderlist/detail', exact: true, name: '订单详情', component: OrderDetail},
  { path: '/Receive', exact: true, name: '收货单', component: TakeOrder},
  { path: '/Receive/detail', exact: true, name: '收货单详情', component: TakeOrderDetail},
  { path: '/Ret', exact: true, name: '退货单', component: ReturnOrder},
  { path: '/Ret/detail', exact: true, name: '退货单详情', component: ReturnOrderDetail},
  { path: '/Debit', exact: true, name: '扣款单', component: DebitOrder},
  { path: '/Debit/detail', exact: true, name: '扣款单详情', component: DebitOrderDetail},
  { path: '/Check', exact: true, name: '对账单', component: StatementOrder},
  { path: '/Check/detail', exact: true, name: '对账单详情', component: StatementOrderDetail},
  { path: '/ckphoto', exact: true, name: '样衣照片审核', component: Ckphoto},
  { path: '/ckphoto/detail', exact: true, name: '审核详情', component: CkphotoDetail},
  { path: '/push', exact: true, name: '样衣海选发布', component: Push},
  { path: '/audition', exact: true, name: '样衣海选', component: Audition},
  { path: '/resolve', exact: true, name: '样衣海选决策', component: Resolve},
  { path: '/resolve/detail', exact: true, name: '决策详情', component: ResolveDetail},
  { path: '/msqr', exact: true, name: '买手确认', component: BuyerConfrim},
  { path: '/msqr/list/:id', exact: true, name: '买手确认列表', component: BuyerConfrimList},
  { path: '/Primary', exact: true, name: '样衣初选收货', component: TakeGoods},
  { path: '/Primary/detail', exact: true, name: '初选收货', component: TakeGoodsDetail},
  { path: '/oneck', exact: true, name: '样衣一审打分', component: OneCheck},
  { path: '/oneck/detail', exact: true, name: '一审打分详情', component: OneCheckDetail},
  { path: '/oneresolve', exact: true, name: '样衣一审决策', component: OneResolve},
  { path: '/oneresolve/detail', exact: true, name: '一审决策详情', component: OneResolveDetail},
  { path: '/out', exact: true, name: '一审淘汰样衣', component: Out},
  { path: '/out/detail', exact: true, name: '淘汰样衣详情', component: OutDetail},
  { path: '/checkstyle', exact: true, name: '样衣风格确认', component: CheckStyle},
  { path: '/datacheck', exact: true, name: '资料审核', component: DataCheck},
  { path: '/datacheck/detail', exact: true, name: '资料审核详情', component: DataCheckdETAIL},
  { path: '/twosub', exact: true, name: '样衣二审提交', component: SecordSubmit},
  { path: '/twosub/detail', exact: true, name: '二审详情', component: SecordSubmitDetail},
  { path: '/Invoice', exact: true, name: '发票确认', component: InvoiceOrder},
  { path: '/Invoice/detail', exact: true, name: '确认详情', component: InvoiceOrderDetail},
  { path: '/Payment', exact: true, name: '付款单', component: PaymentOrder},
  { path: '/Payment/detail', exact: true, name: '付款单详情', component: PaymentOrderDetail},
  { path: '/mgnsp', exact: true, name: '采购经理审批', component: ManagerApproval},
  { path: '/mgnsp/detail', exact: true, name: '审批详情', component: ManagerApprovalDetail},
  { path: '/twockend', exact: true, name: '样衣二审审批', component: SecordApproval},
  { path: '/twockend/detail', exact: true, name: '审批详情', component: SecordApprovalDetail},
  { path: '/photolib', exact: true, name: '图片库', component: CateImg},
]

export const paramsRouters: any [] = [
  { path: '/ssffaawer/lxcs', exact: true, name: '类型参数', component: TypeParam},
  { path: '/ssffaawer/yscs', exact: true, name: '颜色参数', component: ColorParam},
  { path: '/ssffaawer/jjcs', exact: true, name: '季节参数', component: SeasonParam},
  { path: '/ssffaawer/cmcs', exact: true, name: '尺码占比参数', component: SizeParam},
  { path: '/ssffaawer/mdcs', exact: true, name: '门店等级参数', component: ShopgradeParam},
  { path: '/ssffaawer/gysfg', exact: true, name: '供应商风格对应表', component: SupplierStyle},
  { path: '/ssffaawer/mlzd', exact: true, name: '大类面料对应表', component: Fabric},
  { path: '/ssffaawer/qxsz', exact: true, name: '数据权限设置', component: DataPermission},
  { path: '/ssffaawer/lxcs/edit', exact: true, name: '商品类型参数维护', component: TypeParamForm},
  { path: '/ssffaawer/yscs/edit', exact: true, name: '颜色参数维护', component: ColorParamForm},
  { path: '/ssffaawer/jjcs/edit', exact: true, name: '季节参数维护', component: SeasonParamForm},
  { path: '/ssffaawer/cmcs/edit', exact: true, name: '尺码占比参数维护', component: SizeParamForm},
  { path: '/ssffaawer/mdcs/edit', exact: true, name: '门店等级参数维护', component: ShopgradeParamForm},
  { path: '/ssffaawer/gysfg/edit', exact: true, name: '供应商风格维护', component: SupplierStyleForm},
  { path: '/ssffaawer/mlzd/edit', exact: true, name: '大类面料维护', component: FabricForm},
  { path: '/ssffaawer/qxsz/edit', exact: true, name: '数据权限设置维护', component: DataPermissionForm},
]

export const menuRouters: any [] = [...indexRouter, ...paramsRouters]

//这是根组件，最外层的
export default class BaseRoute extends React.Component<{}, {}> {
  render() {
    const routes = [
      { path: '/login', exact: false, name: '登录页', component: Login},
      { path: '/', exact: false, name: '首页', component: Index},
    ]
    return (
      <Router>
        <Switch>
          {routes.map( (route, index) => (
            <Route 
              key={index} 
              path={route.path} 
              exact={route.exact} 
              component ={route.component}
            />
          ))}
        </Switch>
      </Router>
    )
  }
}